package visualizer.graphics;

import processing.core.PGraphics;

public class HsbColor {
	public final int h;
	public final int s;
	public final int b;
	
	public HsbColor(int color)
	{
		this.h = color >> 16 & 255;
		this.s = color >> 8 & 255;
		this.b = color & 255;
	}
	
	public HsbColor(int h, int s, int b)
	{
		this.h = h;
		this.s = s;
		this.b = b;
	}
	
	public HsbColor addHue(int h) {
		return new HsbColor((this.h + h) % 255, this.s, this.b);
	}
	
	public HsbColor stroke(PGraphics g)
	{
		g.colorMode(g.HSB);
		g.stroke(h, s, b);
		return this;
	}
	
	public HsbColor fill(PGraphics g)
	{
		g.colorMode(g.HSB);
		g.fill(h, s, b);
		return this;
	}
}
